Sleep before unlinking to fix a flaky test on windows
authorBrian Anderson <banderson@mozilla.com>
Thu, 11 Dec 2014 23:16:43 +0000 (15:16 -0800)
committerBrian Anderson <banderson@mozilla.com>
Thu, 11 Dec 2014 23:16:43 +0000 (15:16 -0800)
tests/test_cargo_compile.rs

index 225c8c5bd44be73b74ff168541f0ba4d640fc8cc..b87f080361f9d1f5050678b13e37abe082b49726 100644 (file)
@@ -1509,6 +1509,12 @@ test!(compile_then_delete {
 
     assert_that(p.cargo_process("run"), execs().with_status(0));
     assert_that(&p.bin("foo"), existing_file());
+    if cfg!(windows) {
+        // HACKHACK: On windows unlinking immediately after running often fails, so sleep
+        use std::io::timer::sleep;
+        use std::time::duration::Duration;
+        sleep(Duration::milliseconds(100));
+    }
     fs::unlink(&p.bin("foo")).unwrap();
     assert_that(p.process(cargo_dir().join("cargo")).arg("run"),
                 execs().with_status(0));